package com.hedl.practice.StudyAlgorithm.practice;

/**
 * @author Big Watermelon
 * @description 阶乘
 * @date 2024/02/14/17:01
 */
public class Factorial {
    public static long factorial(long number){
        if (number <= 1){
            return 1;
        }else {
            return number * factorial(number-1);
        }
    }

    public static void main(String[] args) {
        for (int counter = 0; counter <= 10; counter++){
            System.out.printf("%d! = %d\n",counter,factorial(counter));
        }
    }
}
